#ifndef PROTOCALPARSING_H
#define PROTOCALPARSING_H
typedef struct
{
  uint8 startFlag;
  uint8  pkLen[4];
  uint8  pkId[2];
  uint8  packetCmd;
  uint8 packetAnswer;
} COM_HEAD_TYPE;

typedef union
{
  unsigned char buffer[1500];
  COM_HEAD_TYPE head;
} COM_COM_TYPE;

#define HEAD_LEN (sizeof(COM_HEAD_TYPE))
#define HIGH_ORDER 1
#define LOW_ORDER 0
#define mqCmd_startFlag 0x7e
#define mqCmd_endFlag 0x7e

#define mqCmd_getAllData 0x01
#define mqCmd_getData 0x02
#define mqCmd_setData 0x03
#define mqCmd_autoReport 0x04
#define mqCmd_getSeriesData 0x05
#define mqCmd_stopReportData 0x06
#define mqCmd_diffDataReport 0x07
#define mqCmd_dotFreqReport 0x08
#define mqCmd_download 0x81

#define mqCmd_transfer 0x82        // 转发设备模块命令
#define mqCmd_getMkParaList 0x83   // 获取模块参数列表命令
#define mqCmd_login 0x84           // 搜索命令
#define mqCmd_fpga_dcap 0x85       // FPGA采集交互命令
#define mqCmd_softSystemReset 0x88 // linux system reset

#define mqRsp_success 0x00
#define mqRsp_condition 0x01
#define mqRsp_cmdError 0x02
#define SET_FLAG 0X01


#define OID_AUTOREPORTDATA        0X8002
#define OID_CURDOT_IDX            0X8003
#define OID_STRIKEDATA            0X8004
#define OID_DIFFREPORTDATA        0X8005
#define OID_DOTFREQREPORTDATA     0X8006
#define OID_OTDRDATA              0X8007




typedef unsigned char uint8 ;
typedef unsigned short int  uint16;
typedef unsigned int uint32;
typedef union
{
    uint16	       word;
    uint8 	       byte[2];
} UNION_2_BYTE;
typedef union
{
    uint32	       lword;
    uint8 	       byte[4];
} UNION_4_BYTE;


#endif
